﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ta_list.aspx.cs" Inherits="EZCRS.HCMS.Web.manage.ta.ta_list" %>

<%@ Register Src="../usercontrol/titlepage.ascx" TagName="titlepage" TagPrefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>TA List</title>
    <link type="text/css" href="../../style/main.css" rel="Stylesheet" />

    <script src="../../common/jquery-1.2.6.min.js"></script>

    <script src="../../common/jquery-impromptu.1.5.js"></script>

    <script src="../../common/flexigrid/flexigrid.js"></script>

    <script src="../../common/winbox.js"></script>

    <link rel="stylesheet" href="../../common/flexigrid/flexigrid.css" type="text/css"
        media="screen" />
    <link rel="stylesheet" href="../../style/dfbDialog.css" type="text/css" media="screen" />
</head>
<body>

    <script type="text/javascript" charset="utf-8">
    
　　
		$(document).ready(function(){
		
		    $('#grid').flexigrid({
		        width: $(document).width() - 10,
		        height: 400,
		        //striped:false,
		        
		        url: window.location.search + '&action=get',
		        
		        dataType: 'json',  
		        
		        colModel: [
		            {display: 'IATA', name : 'iata', width : 100, sortable : false, align: 'left'}, 
                    {display: '名称', name : 'name', width : 200, sortable : false, align: 'left'},   
                    {display: '联系人', name : 'linkman', width : 100, sortable : false, align: 'left'},     
                    {display: 'Tel', name : 'tel', width : 80, sortable : false, align: 'left'},
                    {display: 'Fax', name : 'fax', width : 100, sortable : false, align: 'left'},
                    {display: '创建日期', name : 'create', width : 180, sortable : false, align: 'left'}
                ],
 
                buttons : [
                    { name: '<%= Resources.Site.LabNew %>', bclass:"add", onpress: doCommand},   
                    { name: '<%= Resources.Site.LabDelete %>', bclass:"delete", onpress: doCommand},   
                    { name: '<%= Resources.Site.LabSentRateNotify %>', bclass:"send", onpress: doCommand}, 
                    { separator: true}   
                ], 
                
                showTableToggleBtn: true,
                rp: 15,
                usepager: true,
                useRp: true,
                onSuccess: onDoubleClick
                
		    });
		    
		    
		    $('#btnsearch').click(function (){

                var name = $("#txtName").val();
                
                var channel = $('#ddlChannel').val();
                
		        $('#grid').flexOptions({ query: name + "," + channel }).flexReload();

		    });
		    
		    
		});
		
		
	    function onDoubleClick()
        {
            $('#grid tbody tr td').each(function() {
            
                $(this).dblclick(function(e) {
                
                    var row = $(this).parents('tr');
                    
                    var id = row.children('td').eq(0).children('div').get(0).innerHTML;
                    
                    ShowBox('ta_mod.aspx?iata=' + id, 550);
                    
                });
                
            });
        }
		
		function doCommand(com, grid){
		
            if (com == '<%= Resources.Site.LabNew %>'){  
             
                ShowBox('ta_new.aspx', 550);
                return;
            }
            
            if($('.trSelected', grid)[0] == null) { 
                alert('<%= Resources.Site.NoItemSelected %>');
                return; 
            }
            
            var iatas = "";
            
            $('.trSelected', grid).each(
            
                function(){
                    
                    var id = $(this).children('td').eq(0).children('div').get(0).innerHTML;
                    
                    iatas += id + ',';
                }
            
            );
                
            if (com == '<%= Resources.Site.LabDelete %>'){
            
                if(confirm("<%= Resources.Site.ScriptConfirm %>" + "Items:" + $('.trSelected',grid).length)){
                        
                    var data = { id: iatas };
                    
                    $.post("?action=del", data,
                    
                        function(data, state){
                            
                            doRefresh();
                            
                    }, "json");
                }
                
                
            }
            else if(com == '<%= Resources.Site.LabSentRateNotify %>'){
            
                 window.location = "../air/notify_list.aspx?iata=" + iatas;
                
            }
            
        }
        
                
        function doRefresh(){
            $('#grid').flexOptions().flexReload();
        }
        
        
    </script>

    <form id="form1" runat="server">
    <uc2:titlepage ID="Titlepage1" runat="server" inittitle="<%$ Resources:Site, TitleExpression %>">
    </uc2:titlepage>
    <div>
        <table cellpadding="0" cellspacing="0" class="main-table">
            <tr class="line-even">
                <td>
                    <table width="90%" border="0" cellpadding="5" cellspacing="0">
                        <tr>
                            <td>
                                Channel:
                                <asp:DropDownList ID="ddlChannel" runat="server">
                                </asp:DropDownList>
                                TA Name:
                                <input id="txtName" type="text" class="text-line" />
                                <input id="btnsearch" type="button" value="<%= Resources.Site.LabSearch %>" class="bttn" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    </form>
    <table id="grid">
    </table>
    <div id="loadinfo" align="center">
    </div>
</body>
</html>
